package com.zpark.it.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.checkerframework.checker.units.qual.Length;
import org.springframework.cglib.core.MethodInfo;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * @Title: User
 * @Author Charles
 * @Package com.zpark.it.pojo
 * @Date 2023/7/19 21:19
 */
@Data
@TableName("user")
public class User implements Serializable {
    public static final Long serialVersionUID =1L; //雪花id

    @TableId(type = IdType.AUTO)  //主键自增
    @JsonProperty("user_id")   //json的注解，用于进行属性格式化
    private Integer userId;

    @Size(min = 6)//数据校验
    private String userName;
    /**
     *  @JsonIgnore //忽略属性，不生成json，也不接受json数据
     *   @JsonInclude(JsonInclude.Include.NON_NULL ) +null 当这个值不为null的时候生成json，为空不生成json，不影响接受json
     */

    @JsonInclude(JsonInclude.Include.NON_NULL )
    @NotBlank
    private String password;

    @JsonInclude(JsonInclude.Include.NON_NULL )
    @NotBlank
    private String userPhonenumber;
}
